import cv2 as cv


def main():
    img = cv.imread('../data/test.png')

    scale_up = 1.5
    scale_down = 0.5

    scaled_up_size = (round(img.shape[1] * scale_up), round(img.shape[0] * scale_up))
    scaled_down_size = (round(img.shape[1] * scale_down), round(img.shape[0] * scale_down))

    img_scaled_up = cv.resize(img, scaled_up_size, interpolation=cv.INTER_CUBIC)
    img_scaled_down = cv.resize(img, scaled_down_size, interpolation=cv.INTER_AREA)

    print("原始尺寸:", img.shape, "放大后尺寸:", img_scaled_up.shape, "缩小后尺寸:", img_scaled_down.shape)

    cv.imshow("Original", img)
    cv.imshow("Scaled Up", img_scaled_up)
    cv.imshow("Scaled Down", img_scaled_down)
    cv.waitKey(0)
    cv.destroyAllWindows()


if __name__ == "__main__":
    main()
